//反转二叉树
class Solution4{
    class TreeNode{
        public int val;
        public TreeNode left;
        public TreeNode right;

        public TreeNode(int val) {
            this.val = val;
        }
    }
    public TreeNode invertTree(TreeNode root) {
        if(root==null){
            return null;
        }
        TreeNode ret;
        ret=root.left;
        root.left=root.right;
        root.right=ret;
        invertTree(root.left);
        invertTree(root.right);
        return root;
    }
}